<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <c></c>
  <button @click="butClick">按钮</button>
</div>

<template id="cpn">
  <h1>我是子组件</h1>
</template>

<script src="../js/vue.js"></script>
<script>
  Vue.component('c',{
    template: `#cpn`,
    methods: {
      showMessage() {
        console.log('showMessage----->');
      }
    }
  })
  //let(变量)和const(常量)
  const app = new Vue({
    el: '#app',
    data: {
      message: '中国牛蛙！'
    },
    methods: {
      butClick() {
        console.log(this.$children);
        this.$children[0].showMessage();
      }
    }
  })
</script>
</body>
</html>